package com.AAA.service.Impl.fpa;

import com.AAA.dao.fpa.ITFpaPlaneMapper;
import com.AAA.entity.MyPage;
import com.AAA.entity.fpa.TFpa;
import com.AAA.entity.fpa.TFpaPlane;
import com.AAA.service.fpa.ITFpaPlaneService;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (TFpaPlane)表服务实现类
 *
 * @author 何泽明
 * @since 2022-11-05 16:19:30
 */
@Service
public class ITFpaPlaneServiceImpl implements ITFpaPlaneService {
   @Autowired
   private ITFpaPlaneMapper mapper;

   //分页查询
   @Override
   public PageInfo query(MyPage myPage, TFpaPlane tFpaPlane) {
      PageHelper.startPage(myPage.getPage(),myPage.getLimit());
      List<TFpaPlane> tFpaPlanes = mapper.queryAll(tFpaPlane);
      PageInfo pageInfo = new PageInfo(tFpaPlanes);
      return pageInfo;
   }

   //添加
   @Override
   public boolean add(TFpaPlane tFpaPlane) {
      int insert = mapper.insert(tFpaPlane);
      if (insert>0){
         return true;
      }
      return false;
   }
   //修改
   @Override
   public boolean edit(TFpaPlane tFpaPlane) {
      int insert=mapper.updateByPrimaryKeySelective(tFpaPlane);
      if(insert>0){
         return true;
      }
      return false;
   }

   //状态：开/关（启用/禁用）
   @Override
   public boolean updates(TFpaPlane tFpaPlane) {
      int i = mapper.updateByPrimaryKeySelective(tFpaPlane);
      if (i > 0){
         return true;
      }
      return false;
   }

   @Override
   public TFpaPlane queryByQyCode(TFpaPlane tFpaPlane) {
      TFpaPlane tFpaPlane1 = mapper.selectOne(tFpaPlane);
      return tFpaPlane1;
   }
}

